package icasue.base.lock;

import lombok.Data;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2020/11/3 下午3:44
 * @UpdateDate:
 * @Description:
 */
@Data
public abstract class AbstractDistributedLock implements DistributedLock {

    /**
     * The default timeout ms.
     */
    protected String DEFAULT_TIMEOUT = "5000";
    /**
     * The prefix of concurrency lock.
     */
    protected String CONCURRENCY_KEY_PREFIX = "concurrency:key:";

    @Override
    public String lock(String serviceLock) {
        // try lock is execution body actually, waiting for lock failed or succeed.
        return this.tryLock(serviceLock);
    }

    @Override
    public String lock(String serviceLock, Long time) {
        // try lock is execution body actually, waiting for lock failed or succeed.
        return this.tryLock(serviceLock,time);
    }

}
